package com.meida.student.app.user.controller;

import com.meida.common.mybatis.model.ResultBody;
import com.meida.common.springmvc.base.BaseController;
import com.meida.module.bus.client.entity.BusSubject;
import com.meida.module.bus.provider.service.BusSubjectService;
import com.meida.module.bus.provider.utils.MyUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;


/**
 * 专业控制器
 *
 * @author flyme
 * @date 2021-08-03
 */
@RestController
@RequestMapping("/subject/")
public class ApiSubjectController extends BaseController<BusSubjectService, BusSubject> {

    @ApiOperation(value = "专业价格", notes = "专业价格")
    @GetMapping(value = "getPriceById")
    public ResultBody getPriceById(Long subjectId) {
        BigDecimal amount = bizService.getPriceById(subjectId);
        return ResultBody.ok(amount);
    }

    @ApiOperation(value = "专业价格", notes = "专业价格")
    @GetMapping(value = "getPriceByIds")
    public ResultBody getPriceById(String subjectIds) {
        List<Long> subjectIdList = MyUtils.stringToLongList(subjectIds);
        BigDecimal amount = bizService.getPriceByIds(subjectIdList);
        return ResultBody.ok(amount);
    }

}
